Sending an XML Message via JMS

In the groovy support for General Notices, api.sendXml is used to send an xml message via Java Messaging Service (../../../../../../../display/sn4o/event+processing+via+jms+for+n4+2.1+and+prior+releases). api.sendJMSBytesMessage is used for sending UTF-8 based byte messages.

To call api.sendXML(), you must first configure the destination url on the Facility from the Integration Services view, and reload the the ESB configurations from the Actions menu of the ESB Configurations view.

event.getPropertyXml API will build a string xml given a list of reportable entity tags. The below example sends attributes of a unit.

def list = ["UnitNbr", "Category", "FreightKind", "RequiredTempC", "InTime"]

def xml = event.getPropertyXml("unit", list);

// send the XML to the jms queue specified on the Facility of the current user scope.

api.sendXml(xml)

// also write the message to the system log

api.log(xml)

Execution of the following code will send the following xml message to the facility configured JMS queue.

<unit EVENT_ID="TEST EVENT" EVENT_GKEY="321201" ENTITY_GKEY="12523"

UnitNbr="CRLU3160549"

Category="Import" FreightKind="FCL" RequiredTempC="4.0"

InTime="2006-08-25 05:24" />

The time format is output as configured in the DATE_TIME_DISPLAY_FORMAT settings.

The next example shows sending vessel visit updates via JMS.

In This Section